package demo04;

import java.text.ParseException;
import java.util.Date;

//测试DateUtils工具类.
public class Test {
    public static void main(String[] args) throws ParseException {
        //需求1: 格式化
        Date d = new Date();
        String s = DateUtils.date2String(d, "yyyy/MM/dd");
        System.out.println("格式化: " + s);
        System.out.println("------------------");
        //需求2: 解析.
        String str = "21:13:14";
        Date d2 = DateUtils.string2Date(str, "HH:mm:ss");
        System.out.println("解析: " + d2);
    }
}
